Video encoding/decoding method and device, and recording medium having bitstream stored therein

ABSTRACT

An image encoding/decoding method and apparatus for performing intra prediction are provided. An image decoding method of the present invention comprises deriving an intra-prediction mode for a current block, determining whether or not a left boundary or an upper boundary of the current block is a boundary of a predetermined image region, configuring a reference sample by using at least one reconstructed sample included in at least one reconstructed sample line adjacent to the current block based on the determination result, and performing intra-prediction for the current block based on the intra-prediction mode and the reference sample.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a U.S. National Stage Application of InternationalApplication No. PCT/KR2017/009945, filed on Sep. 11, 2017, which claimsthe benefit under 35 USC 119(a) and 365(b) of Korean Patent ApplicationNo. 10-2016-0117900, filed on Sep. 13, 2016, in the Korean IntellectualProperty Office.

TECHNICAL FIELD

The present invention relates to a method and apparatus forencoding/decoding an image and a recording medium storing a bitstream.Particularly, the present invention relates to a method and apparatusfor encoding/decoding an image using intra prediction and a recordingmedium storing a bitstream generated by an image encodingmethod/apparatus of the present invention.

BACKGROUND ART

Recently, demands for high-resolution and high-quality images such ashigh definition (HD) images and ultra high definition (UHD) images, haveincreased in various application fields. However, higher resolution andquality image data has increasing amounts of data in comparison withconventional image data. Therefore, when transmitting image data byusing a medium such as conventional wired and wireless broadbandnetworks, or when storing image data by using a conventional storagemedium, costs of transmitting and storing increase. In order to solvethese problems occurring with an increase in resolution and quality ofimage data, high-efficiency image encoding/decoding techniques arerequired for higher-resolution and higher-quality images.

Image compression technology includes various techniques, including: aninter-prediction technique of predicting a pixel value included in acurrent picture from a previous or subsequent picture of the currentpicture; an intra-prediction technique of predicting a pixel valueincluded in a current picture by using pixel information in the currentpicture; a transform and quantization technique for compressing energyof a residual signal; an entropy encoding technique of assigning a shortcode to a value with a high appearance frequency and assigning a longcode to a value with a low appearance frequency; etc. Image data may beeffectively compressed by using such image compression technology, andmay be transmitted or stored.

In a conventional intra prediction, reconstructed samples located in aplurality of line buffers are used for constructing a reference sample.Therefore, when implementing an encoder/decoder, additional hardwareresources and memory bandwidth are required comparing to a case where asingle line buffer is used or a case where no line buffer is used.

DISCLOSURE Technical Problem

An object of the present invention is to provide an imageencoding/decoding method and apparatus enabling efficient usage ofresources.

Another object of the present invention is to provide an imageencoding/decoding method and apparatus which use resources required foran intra prediction efficiently.

Another object of the present invention is to provide a method andapparatus for determining the number and locations of reconstructedsample lines used for constructing a reference sample based on alocation of the current block within a predetermined image region todecrease a size of a line buffer used for intra prediction.

Another object of the present invention is to provide a recording mediumstoring a bitstream generated by an image encoding method/apparatus ofthe present invention.

Technical Solution

An image decoding method according to the present invention may comprisederiving an intra-prediction mode for a current block, determiningwhether or not a left boundary or an upper boundary of the current blockis a boundary of a predetermined image region, configuring a referencesample by using at least one reconstructed sample included in at leastone reconstructed sample line adjacent to the current block based on thedetermination result, and performing intra-prediction for the currentblock based on the intra-prediction mode and the reference sample.

In an image decoding method of the present invention, the predeterminedimage region may be one of a picture, a slice, a slice segment, a tile,and a coding tree block.

In an image decoding method of the present invention, when both of theleft boundary and the upper boundary of the current block are not theboundary of the predetermined image region, the reference sample may beconfigured by using a same reconstructed sample line for the left sideand the upper side of the current block.

In an image decoding method of the present invention, when a firstboundary among the left and upper boundaries of the current block is theboundary of the predetermined image region, and a remaining secondboundary is not the boundary of the predetermined image region, a numberof the reconstructed sample lines used for configuring the referencesample or a position thereof may be different with respect to the firstboundary and the second boundary.

In an image decoding method of the present invention, the first boundarymay be the upper boundary, and the second boundary may be the leftboundary.

In an image decoding method of the present invention, when a singlereconstructed sample line among the at least one reconstructed sampleline is used for configuring the reference sample, a reference samplefor the first boundary may be configured by using a reconstructed sampleline that is mostly adjacent to the current block, and a referencesample for the second boundary may be configured by using a singlereconstructed sample line that is selected from the at least onereconstructed sample line.

In an image decoding method of the present invention, when at least tworeconstructed sample lines among the at least one reconstructed sampleline are used when configuring the reference sample, a reference samplefor the first boundary may be configured by using multiple times areconstructed sample line that is mostly adjacent to the current block,and a reference sample for the second boundary may be configured byusing at least two reconstructed sample lines selected among the atleast one reconstructed sample line.

In an image decoding method of the present invention, when at least tworeconstructed sample lines among the at least one reconstructed sampleline are used to configure the reference sample, the reference samplemay be configured by using at least one of a weighted sum, an averagevalue, a maximum value, a minimum value, and a median value of at leasttwo reconstructed samples on the at least two reconstructed samplelines.

In an image decoding method of the present invention, positions of theat least two reconstructed samples may be variably determined based on aposition of a prediction target sample within the current block.

In an image decoding method of the present invention, a weight used inthe weighted sum may be determined based on a distance from the currentblock.

In an image decoding method of the present invention, when both of theleft and upper boundaries of the current block are boundaries of thepredetermined image region, the reference sample may be configured byusing a same reconstructed sample line or different reconstructed samplelines for the left side and the upper side of the current block.

In an image decoding method of the present invention, when the referencesample is configured by using different reconstructed sample lines forthe left side and the upper side of the current block, a number ofreconstructed sample lines used for the left side of the current blockmay be larger than a number of reconstructed sample lines used for theupper side of the current block.

An image encoding method according to the present invention may comprisedetermining an intra-prediction mode for a current block, determiningwhether or not a left boundary or an upper boundary of the current blockis a boundary of a predetermined image region, configuring a referencesample by using at least one reconstructed sample included in at leastone reconstructed sample line adjacent to the current block based on thedetermination result, and performing intra-prediction for the currentblock based on the intra-prediction mode and the reference sample.

An image decoding apparatus according to the present invention maycomprise an intra predictor which is configured to derive anintra-prediction mode for a current block, determine whether or not aleft boundary or an upper boundary of the current block is a boundary ofa predetermined image region, configure a reference sample by using atleast one reconstructed sample included in at least one reconstructedsample line adjacent to the current block based on the determinationresult, and perform intra-prediction for the current block based on theintra-prediction mode and the reference sample.

An image encoding apparatus may comprise an intra predictor which isconfigured to determine an intra-prediction mode for a current block,determine whether or not a left boundary or an upper boundary of thecurrent block is a boundary of a predetermined image region, configure areference sample by using at least one reconstructed sample included inat least one reconstructed sample line adjacent to the current blockbased on the determination result, and perform intra-prediction for thecurrent block based on the intra-prediction mode and the referencesample.

A recording medium according to the present invention may store abitstream generated by an image encoding method according to the presentinvention.

Advantageous Effects

According to the present invention, an image encoding/decoding methodand apparatus enabling efficient usage of resources may be provided.

And according to the present invention, an image encoding/decodingmethod and apparatus which use resources required for an intraprediction efficiently may be provided.

And according to the present invention, an image encoding/decodingmethod and apparatus for decreasing hardware resources and bandwidthrequired for implementing an encoder/decoder by decreasing a size of aline buffer used for intra prediction may be provided.

And according to the present invention, a recording medium storing abitstream generated by an image encoding method/apparatus of the presentinvention may be provided.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram showing configurations of an encodingapparatus according to an embodiment of the present invention.

FIG. 2 is a block diagram showing configurations of a decoding apparatusaccording to an embodiment of the present invention.

FIG. 3 is a view schematically showing a partition structure of an imagewhen encoding and decoding the image.

FIG. 4 is a view for explaining an embodiment of a process of intraprediction.

FIG. 5 is a view showing intra-prediction according to the presentinvention.

FIG. 6 is a view showing an example of configuring a reference sampleline when a current block is not adjacent to a CTU boundary.

FIG. 7 is a view showing an example of configuring a reference sampleline when a current block is adjacent to a CTU boundary.

MODE FOR INVENTION

A variety of modifications may be made to the present invention andthere are various embodiments of the present invention, examples ofwhich will now be provided with reference to drawings and described indetail. However, the present invention is not limited thereto, althoughthe exemplary embodiments can be construed as including allmodifications, equivalents, or substitutes in a technical concept and atechnical scope of the present invention. The similar reference numeralsrefer to the same or similar functions in various aspects. In thedrawings, the shapes and dimensions of elements may be exaggerated forclarity. In the following detailed description of the present invention,references are made to the accompanying drawings that show, by way ofillustration, specific embodiments in which the invention may bepracticed. These embodiments are described in sufficient detail toenable those skilled in the art to implement the present disclosure. Itshould be understood that various embodiments of the present disclosure,although different, are not necessarily mutually exclusive. For example,specific features, structures, and characteristics described herein, inconnection with one embodiment, may be implemented within otherembodiments without departing from the spirit and scope of the presentdisclosure. In addition, it should be understood that the location orarrangement of individual elements within each disclosed embodiment maybe modified without departing from the spirit and scope of the presentdisclosure. The following detailed description is, therefore, not to betaken in a limiting sense, and the scope of the present disclosure isdefined only by the appended claims, appropriately interpreted, alongwith the full range of equivalents to what the claims claim.

Terms used in the specification, ‘first’, ‘second’, etc. can be used todescribe various components, but the components are not to be construedas being limited to the terms. The terms are only used to differentiateone component from other components. For example, the ‘first’ componentmay be named the ‘second’ component without departing from the scope ofthe present invention, and the ‘second’ component may also be similarlynamed the ‘first’ component. The term ‘and/or’ includes a combination ofa plurality of items or any one of a plurality of terms.

It will be understood that when an element is simply referred to asbeing ‘connected to’ or ‘coupled to’ another element without being‘directly connected to’ or ‘directly coupled to’ another element in thepresent description, it may be ‘directly connected to’ or ‘directlycoupled to’ another element or be connected to or coupled to anotherelement, having the other element intervening therebetween. In contrast,it should be understood that when an element is referred to as being“directly coupled” or “directly connected” to another element, there areno intervening elements present.

Furthermore, constitutional parts shown in the embodiments of thepresent invention are independently shown so as to representcharacteristic functions different from each other. Thus, it does notmean that each constitutional part is constituted in a constitutionalunit of separated hardware or software. In other words, eachconstitutional part includes each of enumerated constitutional parts forconvenience. Thus, at least two constitutional parts of eachconstitutional part may be combined to form one constitutional part orone constitutional part may be divided into a plurality ofconstitutional parts to perform each function. The embodiment where eachconstitutional part is combined and the embodiment where oneconstitutional part is divided are also included in the scope of thepresent invention, if not departing from the essence of the presentinvention.

The terms used in the present specification are merely used to describeparticular embodiments, and are not intended to limit the presentinvention. An expression used in the singular encompasses the expressionof the plural, unless it has a clearly different meaning in the context.In the present specification, it is to be understood that terms such as“including”, “having”, etc. are intended to indicate the existence ofthe features, numbers, steps, actions, elements, parts, or combinationsthereof disclosed in the specification, and are not intended to precludethe possibility that one or more other features, numbers, steps,actions, elements, parts, or combinations thereof may exist or may beadded. In other words, when a specific element is referred to as being“included”, elements other than the corresponding element are notexcluded, but additional elements may be included in embodiments of thepresent invention or the scope of the present invention.

In addition, some of constituents may not be indispensable constituentsperforming essential functions of the present invention but be selectiveconstituents improving only performance thereof. The present inventionmay be implemented by including only the indispensable constitutionalparts for implementing the essence of the present invention except theconstituents used in improving performance. The structure including onlythe indispensable constituents except the selective constituents used inimproving only performance is also included in the scope of the presentinvention.

Hereinafter, embodiments of the present invention will be described indetail with reference to the accompanying drawings. In describingexemplary embodiments of the present invention, well-known functions orconstructions will not be described in detail since they mayunnecessarily obscure the understanding of the present invention. Thesame constituent elements in the drawings are denoted by the samereference numerals, and a repeated description of the same elements willbe omitted.

In addition, hereinafter, an image may mean a picture configuring avideo, or may mean the video itself. For example, “encoding or decodingor both of an image” may mean “encoding or decoding or both of a video”,and may mean “encoding or decoding or both of one image among images ofa video.” Here, a picture and the image may have the same meaning.

DESCRIPTION OF TERMS

Encoder: means an apparatus performing encoding. Decoder: means anapparatus performing decoding

Block: is an M×N array of a sample. Herein, M and N mean positiveintegers, and the block may mean a sample array of a two-dimensionalform. The block may refer to a unit. A current block my mean an encodingtarget block that becomes a target when encoding, or a decoding targetblock that becomes a target when decoding. In addition, the currentblock may be at least one of an encode block, a prediction block, aresidual block, and a transform block.

Sample: is a basic unit constituting a block. It may be expressed as avalue from 0 to 2Bd−1 according to a bit depth (Bd). In the presentinvention, the sample may be used as a meaning of a pixel.

Unit: refers to an encoding and decoding unit. When encoding anddecoding an image, the unit may be a region generated by partitioning asingle image. In addition, the unit may mean a subdivided unit when asingle image is partitioned into subdivided units during encoding ordecoding. When encoding and decoding an image, a predetermined processfor each unit may be performed. A single unit may be partitioned intosub-units that have sizes smaller than the size of the unit. Dependingon functions, the unit may mean a block, a macroblock, a coding treeunit, a code tree block, a coding unit, a coding block), a predictionunit, a prediction block, a residual unit), a residual block, atransform unit, a transform block, etc. In addition, in order todistinguish a unit from a block, the unit may include a luma componentblock, a chroma component block associated with the luma componentblock, and a syntax element of each color component block. The unit mayhave various sizes and forms, and particularly, the form of the unit maybe a two-dimensional geometrical figure such as a rectangular shape, asquare shape, a trapezoid shape, a triangular shape, a pentagonal shape,etc. In addition, unit information may include at least one of a unittype indicating the coding unit, the prediction unit, the transformunit, etc., and a unit size, a unit depth, a sequence of encoding anddecoding of a unit, etc.

Coding Tree Unit: is configured with a single coding tree block of aluma component Y, and two coding tree blocks related to chromacomponents Cb and Cr. In addition, it may mean that including the blocksand a syntax element of each block. Each coding tree unit may bepartitioned by using at least one of a quad-tree partitioning method anda binary-tree partitioning method to configure a lower unit such ascoding unit, prediction unit, transform unit, etc. It may be used as aterm for designating a pixel block that becomes a process unit whenencoding/decoding an image as an input image.

Coding Tree Block: may be used as a term for designating any one of a Ycoding tree block, Cb coding tree block, and Cr coding tree block.

Neighbor Block: means a block adjacent to a current block. The blockadjacent to the current block may mean a block that comes into contactwith a boundary of the current block, or a block positioned within apredetermined distance from the current block. The neighbor block maymean a block adjacent to a vertex of the current block. Herein, theblock adjacent to the vertex of the current block may mean a blockvertically adjacent to a neighbor block that is horizontally adjacent tothe current block, or a block horizontally adjacent to a neighbor blockthat is vertically adjacent to the current block.

Reconstructed Neighbor block: means a neighbor block adjacent to acurrent block and which has been already spatially/temporally encoded ordecoded. Herein, the reconstructed neighbor block may mean areconstructed neighbor unit. A reconstructed spatial neighbor block maybe a block within a current picture and which has been alreadyreconstructed through encoding or decoding or both. A reconstructedtemporal neighbor block is a block at the same position as the currentblock of the current picture within a reference picture, or a neighborblock thereof.

Unit Depth: means a partitioned degree of a unit. In a tree structure, aroot node may be the highest node, and a leaf node may be the lowestnode. In addition, when a unit is expressed as a tree structure, a levelin which a unit is present may mean a unit depth.

Bitstream: means a bitstream including encoding image information.

Parameter Set: corresponds to header information among a configurationwithin a bitstream. At least one of a video parameter set, a sequenceparameter set, a picture parameter set, and an adaptation parameter setmay be included in a parameter set. In addition, a parameter set mayinclude a slice header, and tile header information.

Parsing: may mean determination of a value of a syntax element byperforming entropy decoding, or may mean the entropy decoding itself.

Symbol: may mean at least one of a syntax element, a coding parameter,and a transform coefficient value of an encoding/decoding target unit.In addition, the symbol may mean an entropy encoding target or anentropy decoding result.

Prediction Unit: means a basic unit when performing prediction such asinter-prediction, intra-prediction, inter-compensation,intra-compensation, and motion compensation. A single prediction unitmay be partitioned into a plurality of partitions with a small size, ormay be partitioned into a lower prediction unit.

Prediction Unit Partition: means a form obtained by partitioning aprediction unit.

Transform Unit: means a basic unit when performing encoding/decodingsuch as transform, reverse-transform, quantization, dequantization,transform coefficient encoding/decoding of a residual signal. A singletransform unit may be partitioned into a plurality of transform unitshaving a small size.

FIG. 1 is a block diagram showing a configuration of an encodingapparatus according to an embodiment to which the present invention isapplied.

An encoding apparatus 100 may be an encoder, a video encoding apparatus,or an image encoding apparatus. A video may include at least one image.The encoding apparatus 100 may sequentially encode at least one image.

Referring to FIG. 1, the encoding apparatus 100 may include a motionprediction unit 111, a motion compensation unit 112, an intra-predictionunit 120, a switch 115, a subtractor 125, a transform unit 130, aquantization unit 140, an entropy encoding unit 150, a dequantizationunit 160, a reverse-transform unit 170, an adder 175, a filter unit 180,and a reference picture buffer 190.

The encoding apparatus 100 may perform encoding of an input image byusing an intra mode or an inter mode or both. In addition, encodingapparatus 100 may generate a bitstream through encoding the input image,and output the generated bitstream. The generated bitstream may bestored in a computer readable recording medium, or may be streamedthrough a wired/wireless transmission medium. When an intra mode is usedas a prediction mode, the switch 115 may be switched to an intra.Alternatively, when an inter mode is used as a prediction mode, theswitch 115 may be switched to an inter mode. Herein, the intra mode maymean an intra-prediction mode, and the inter mode may mean aninter-prediction mode. The encoding apparatus 100 may generate aprediction block for an input block of the input image. In addition, theencoding apparatus 100 may encode a residual of the input block and theprediction block after the prediction block being generated. The inputimage may be called as a current image that is a current encodingtarget. The input block may be called as a current block that is currentencoding target, or as an encoding target block.

When a prediction mode is an intra mode, the intra-prediction unit 120may use a pixel value of a block that has been already encoded/decodedand is adjacent to a current block as a reference pixel. Theintra-prediction unit 120 may perform spatial prediction by using areference pixel, or generate prediction samples of an input block byperforming spatial prediction. Herein, the intra prediction may meanintra-prediction,

When a prediction mode is an inter mode, the motion prediction unit 111may retrieve a region that best matches with an input block from areference image when performing motion prediction, and deduce a motionvector by using the retrieved region. The reference image may be storedin the reference picture buffer 190.

The motion compensation unit 112 may generate a prediction block byperforming motion compensation using a motion vector. Herein,inter-prediction may mean inter-prediction or motion compensation.

The subtractor 125 may generate a residual block by using a residual ofan input block and a prediction block. The residual block may be calledas a residual signal. The residual signal may mean a difference betweenan original signal and a prediction signal. In addition, the residualsignal may be a signal generated by transforming or quantizing, ortransforming and quantizing a difference between the original signal andthe prediction signal. The residual block may be a residual signal of ablock unit.

The transform unit 130 may generate a transform coefficient byperforming transform of a residual block, and output the generatedtransform coefficient. Herein, the transform coefficient may be acoefficient value generated by performing transform of the residualblock. When a transform skip mode is applied, the transform unit 130 mayskip transform of the residual block.

A quantized level may be generated by applying quantization to thetransform coefficient or to the residual signal. Hereinafter, thequantized level may be also called as a transform coefficient inembodiments.

The quantization unit 140 may generate a quantized level by quantizingthe transform coefficient or the residual signal according to aparameter, and output the generated quantized level. Herein, thequantization unit 140 may quantize the transform coefficient by using aquantization matrix.

The entropy encoding unit 150 may generate a bitstream by performingentropy encoding according to a probability distribution on valuescalculated by the quantization unit 140 or on coding parameter valuescalculated when performing encoding, and output the generated bitstream.The entropy encoding unit 150 may perform entropy encoding of pixelinformation of an image and information for decoding an image. Forexample, the information for decoding the image may include a syntaxelement.

When entropy encoding is applied, symbols are represented so that asmaller number of bits are assigned to a symbol having a high chance ofbeing generated and a larger number of bits are assigned to a symbolhaving a low chance of being generated, and thus, the size of bit streamfor symbols to be encoded may be decreased. The entropy encoding unit150 may use an encoding method for entropy encoding such as exponentialGolomb, context-adaptive variable length coding (CAVLC),context-adaptive binary arithmetic coding (CABAC), etc. For example, theentropy encoding unit 150 may perform entropy encoding by using avariable length coding/code (VLC) table. In addition, the entropyencoding unit 150 may deduce a binarization method of a target symboland a probability model of a target symbol/bin, and perform arithmeticcoding by using the deduced binarization method, and a context model.

In order to encode a transform coefficient level, the entropy encodingunit 150 may change a two-dimensional block form coefficient into aone-dimensional vector form by using a transform coefficient scanningmethod.

A coding parameter may include information (flag, index, etc.) such assyntax element that is encoded in an encoder and signaled to a decoder,and information derived when performing encoding or decoding. The codingparameter may mean information required when encoding or decoding animage. For example, at least one value or a combination form of a blocksize, a block depth, block partition information, a unit size, a unitdepth, unit partition information, a partition flag of a quad-tree form,a partition flag of a binary-tree form, a partition angle of abinary-tree form, an intra-prediction mode, an intra-prediction angle, areference sample filtering method, a prediction block boundary filteringmethod, a filter tap, a filter coefficient, an inter-prediction mode,motion information, a motion vector, a reference image index, ainter-prediction angle, an inter-prediction indicator, a reference imagelist, a motion vector predictor, a motion vector candidate list, whetheror not a motion merge mode is used, a motion merge candidate, a motionmerge candidate list, whether or not a skip mode is used, aninterpolation filter type, a motion vector size, a presentation accuracyof a motion vector, a transform type, a transform size, information ofwhether or not an additional (secondary) transform is used, informationof whether or not a residual signal is present, a coded block pattern, acoded block flag, a quantization parameter, a quantization matrix,in-loop filter information, information of whether or not an in-loopfilter is applied, an in-loop filter coefficient,binarization/reverse-binarization method, a context model, a contextbin, a bypass bin, a transform coefficient, a transform coefficientlevel, a transform coefficient level scanning method, an imagedisplaying/outputting sequence, slice identification information, aslice type, slice partition information, tile identificationinformation, a tile type, tile partition information, a picture type, abit depth, and information of a luma signal or chroma signal may beincluded in the coding parameter.

Herein, signaling the flag or index may mean that a corresponding flagor index is entropy encoded and included in a bitstream by an encoder,and may mean that the corresponding flag or index is entropy decodedfrom a bitstream by a decoder.

When the encoding apparatus 100 performs encoding throughinter-prediction, an encoded current image may be used as a referenceimage for another image that is processed afterwards. Accordingly, theencoding apparatus 100 may reconstruct or decode the encoded currentimage, or store the reconstructed or decoded image as a reference image.

A quantized level may be dequantized in the dequantization unit 160, ormay be reverse-transformed in the reverse-transform unit 170. Adequantized or reverse-transformed coefficient or both may be added witha prediction block by the adder 175. By adding the dequantized orreverse-transformed coefficient or both with the prediction block, areconstructed block may be generated. Herein, the dequantized orreverse-transformed coefficient or both may mean a coefficient on whichat least one of dequantization and reverse-transform is performed, andmay mean a reconstructed residual block.

A reconstructed block may pass through the filter unit 180. The filterunit 180 may apply at least one of a deblocking filter, a sampleadaptive offset (SAO), and an adaptive loop filter (ALF) to thereconstructed block or a reconstructed image. The filter unit 180 may becalled as an in-loop filter.

The deblocking filter may remove block distortion generated inboundaries between blocks. In order to determine whether or not to applya deblocking filter, whether or not to apply a deblocking filter to acurrent block may be determined based pixels included in several rows orcolumns which are included in the block. When a deblocking filter isapplied to a block, another filter may be applied according to arequired deblocking filtering strength.

In order to compensate an encoding error, a proper offset value may beadded to a pixel value by using a sample adaptive offset. The sampleadaptive offset may correct an offset of a deblocked image from anoriginal image by a pixel unit. A method of partitioning pixels of animage into a predetermined number of regions, determining a region towhich an offset is applied, and applying the offset to the determinedregion, or a method of applying an offset in consideration of edgeinformation on each pixel may be used.

The adaptive loop filter may perform filtering based on a comparisonresult of the filtered reconstructed image and the original image.Pixels included in an image may be partitioned into predeterminedgroups, a filter to be applied to each group may be determined, anddifferential filtering may be performed for each group. Information ofwhether or not to apply the ALF may be signaled by coding units (CUs),and a form and coefficient of the ALF to be applied to each block mayvary.

The reconstructed block or the reconstructed image having passed throughthe filter unit 180 may be stored in the reference picture buffer 190.FIG. 2 is a block diagram showing a configuration of a decodingapparatus according to an embodiment and to which the present inventionis applied.

A decoding apparatus 200 may a decoder, a video decoding apparatus, oran image decoding apparatus.

Referring to FIG. 2, the decoding apparatus 200 may include an entropydecoding unit 210, a dequantization unit 220, a reverse-transform unit230, an intra-prediction unit 240, a motion compensation unit 250, anadder 225, a filter unit 260, and a reference picture buffer 270.

The decoding apparatus 200 may receive a bitstream output from theencoding apparatus 100. The decoding apparatus 200 may receive abitstream stored in a computer readable recording medium, or may receivea bitstream that is streamed through a wired/wireless transmissionmedium. The decoding apparatus 200 may decode the bitstream by using anintra mode or an inter mode. In addition, the decoding apparatus 200 maygenerate a reconstructed image generated through decoding or a decodedimage, and output the reconstructed image or decoded image.

When a prediction mode used when decoding is an intra mode, a switch maybe switched to an intra. Alternatively, when a prediction mode used whendecoding is an inter mode, a switch may be switched to an inter mode.

The decoding apparatus 200 may obtain a reconstructed residual block bydecoding the input bitstream, and generate a prediction block. When thereconstructed residual block and the prediction block are obtained, thedecoding apparatus 200 may generate a reconstructed block that becomes adecoding target by adding the reconstructed residual block with theprediction block. The decoding target block may be called a currentblock.

The entropy decoding unit 210 may generate symbols by entropy decodingthe bitstream according to a probability distribution. The generatedsymbols may include a symbol of a quantized level form. Herein, anentropy decoding method may be a reverse-process of the entropy encodingmethod described above.

In order to decode a transform coefficient level, the entropy decodingunit 210 may change a one-directional vector form coefficient into atwo-dimensional block form by using a transform coefficient scanningmethod.

A quantized level may be dequantized in the dequantization unit 220, orreverse-transformed in the reverse-transform unit 230. The quantizedlevel may be a result of dequantizing or reverse-transforming or both,and may be generated as a reconstructed residual block. Herein, thedequantization unit 220 may apply a quantization matrix to the quantizedlevel.

When an intra mode is used, the intra-prediction unit 240 may generate aprediction block by performing spatial prediction that uses a pixelvalue of a block adjacent to a decoding target block and which has beenalready decoded.

When an inter mode is used, the motion compensation unit 250 maygenerate a prediction block by performing motion compensation that usesa motion vector and a reference image stored in the reference picturebuffer 270.

The adder 225 may generate a reconstructed block by adding thereconstructed residual block with the prediction block. The filter unit260 may apply at least one of a deblocking filter, a sample adaptiveoffset, and an adaptive loop filter to the reconstructed block orreconstructed image. The filter unit 260 may output the reconstructedimage. The reconstructed block or reconstructed image may be stored inthe reference picture buffer 270 and used when performinginter-prediction.

FIG. 3 is a view schematically showing a partition structure of an imagewhen encoding and decoding the image. FIG. 3 schematically shows anexample of partitioning a single unit into a plurality of lower units.

In order to efficiently partition an image, when encoding and decoding,a coding unit (CU) may be used. The coding unit may be used as a basicunit when encoding/decoding the image. In addition, the coding unit maybe used as a unit for distinguishing an intra mode and an inter modewhen encoding/decoding the image. The coding unit may be a basic unitused for prediction, transform, quantization, reverse-transform,dequantization, or an encoding/decoding process of a transformcoefficient.

Referring to FIG. 3, an image 300 is sequentially partitioned in alargest coding unit (LCU), and a LCU unit is determined as a partitionstructure. Herein, the LCU may be used in the same meaning as a codingtree unit (CTU). A unit partitioning may mean partitioning a blockassociated with to the unit. In block partition information, informationof a unit depth may be included. Depth information may represent anumber of times or a degree or both in which a unit is partitioned. Asingle unit may be partitioned in a layer associated with depthinformation based on a tree structure. Each of partitioned lower unitmay have depth information. Depth information may be informationrepresenting a size of a CU, and may be stored in each CU.

A partition structure may mean a distribution of a coding unit (CU)within an LCU 310. Such a distribution may be determined according towhether or not to partition a single CU into a plurality (positiveinteger equal to or greater than 2 including 2, 4, 8, 16, etc.) of CUs.A horizontal size and a vertical size of the CU generated bypartitioning may respectively be half of a horizontal size and avertical size of the CU before partitioning, or may respectively havesizes smaller than a horizontal size and a vertical size beforepartitioning according to a number of times of partitioning. The CU maybe recursively partitioned into a plurality of CUs. Partitioning of theCU may be recursively performed until to a predefined depth orpredefined size. For example, a depth of an LCU may be 0, and a depth ofa smallest coding unit (SCU) may be a predefined maximum depth. Herein,the LCU may be a coding unit having a maximum coding unit size, and theSCU may be a coding unit having a minimum coding unit size as describedabove. Partitioning is started from the LCU 310, a CU depth increases by1 as a horizontal size or a vertical size or both of the CU decreases bypartitioning.

In addition, information whether or not the CU is partitioned may berepresented by using partition information of the CU. The partitioninformation may be 1-bit information. All CUs, except for a SCU, mayinclude partition information. For example, when a value of partitioninformation is 1, the CU may not be partitioned, when a value ofpartition information is 2, the CU may be partitioned.

Referring to FIG. 3, an LCU having a depth 0 may be a 64×64 block. 0 maybe a minimum depth. A SCU having a depth 3 may be an 8×8 block. 3 may bea maximum depth. A CU of a 32×32 block and a 16×16 block may berespectively represented as a depth 1 and a depth 2.

For example, when a single coding unit is partitioned into four codingunits, a horizontal size and a vertical size of the four partitionedcoding units may be a half size of a horizontal and vertical size of theCU before being partitioned. In one embodiment, when a coding unithaving a 32×32 size is partitioned into four coding units, each of thefour partitioned coding units may have a 16×16 size. When a singlecoding unit is partitioned into four coding units, it may be called thatthe coding unit may be partitioned into a quad-tree form.

For example, when a single coding unit is partitioned into two codingunits, a horizontal or vertical size of the two coding units may be ahalf of a horizontal or vertical size of the coding unit before beingpartitioned. For example, when a coding unit having a 32×32 size ispartitioned in a vertical direction, each of two partitioned codingunits may have a size of 16×32. When a single coding unit is partitionedinto two coding units, it may be called that the coding unit ispartitioned in a binary-tree form. An LCU 320 of FIG. 3 is an example ofan LCU to which both of partitioning of a quad-tree form andpartitioning of a binary-tree form are applied.

FIG. 4 is a view showing an intra-prediction process.

An intra-prediction mode may be a non-angular mode or an angular mode.The non-angular mode may be a DC mode or a planar mode, and the angularmode may be a prediction mode having a specific direction or angle. Theintra-prediction mode may be expressed by at least one of a mode number,a mode value, a mode numeral, and a mode angle. A number ofintra-prediction modes may be M including 1, and the non-angular and theangular mode.

A number of intra-prediction modes may be fixed to N regardless of ablock size. Alternatively, a number of intra-prediction modes may varyaccording to a block size or a color component type or both. Forexample, as a block size becomes large, a number of intra-predictionmodes may increase. Alternatively, a number of intra-prediction modes ofa luma component block may be larger than a number of intra-predictionmodes of a chroma component block.

In order to intra-predict a current block, a step of determining whetheror not samples included in a reconstructed neighbor block may be used asreference samples of the current block may be performed. When a samplethat is not usable as a reference sample of the current block ispresent, a value obtained by duplicating or performing interpolation onat least one sample value among samples included in the reconstructedneighbor block or both may be used to replace with a non-usable samplevalue of a sample, thus the replaced sample value is used as a referencesample of the current block.

When intra-predicting, a filter may be applied to at least one of areference sample and a prediction sample based on an intra-predictionmode and a current block size.

In case of a planar mode, when generating a prediction block of acurrent block, according to a position of a prediction target samplewithin a prediction block, a sample value of the prediction targetsample may be generated by using a weighted sum of an upper and leftside reference sample of a current sample, and a right upper side andleft lower side reference sample of the current block. In addition, incase of a DC mode, when generating a prediction block of a currentblock, an average value of upper side and left side reference samples ofthe current block may be used. In addition, in case of an angular mode,a prediction block may be generated by using an upper side, a left side,a right upper side, and/or a left lower side reference sample of thecurrent block. In order to generate a prediction sample value,interpolation of a real number unit may be performed.

An intra-prediction mode of a current block may be entropyencoded/decoded by predicting an intra-prediction mode of a blockpresent adjacent to the current block. When intra-prediction modes ofthe current block and the neighbor block are identical, information thatthe intra-prediction modes of the current block and the neighbor blockare identical may be signaled by using predetermined flag information.In addition, indicator information of an intra-prediction mode that isidentical to the intra-prediction mode of the current block amongintra-prediction modes of a plurality of neighbor blocks may besignaled. When intra-prediction modes of the current block and theneighbor block are different, intra-prediction mode information of thecurrent block may be entropy encoded/decoded by performing entropyencoding/decoding based on the intra-prediction mode of the neighborblock.

FIG. 5 is a view showing intra-prediction according to the presentinvention.

Intra-prediction of a current block may include: step S510 of derivingan intra-prediction mode, step S520 of configuring a reference sample,and/or step S530 of performing intra-prediction.

In step S510, an intra-prediction mode of a current block may bederived. The intra-prediction mode of the current block may be derivedby using a method of using an intra-prediction mode of a neighbor block,a method of entropy encoding/decoding an intra-prediction mode of acurrent block from a bitstream, or a method of using a coding parameterof a neighbor block. According to the method of using theintra-prediction mode of the neighbor block, the intra-prediction modeof the current block may be derived by using at least oneintra-prediction mode derived by using an intra-prediction mode of aneighbor block, a combination of at least one intra-prediction mode of aneighbor block, and at least one MPM.

In step S520, a reference sample may be configured by performing atleast one of reference sample selecting and reference sample filtering.

In step S530, intra-prediction may be performed by performing at leastone of non-angular prediction, angular prediction, positionalinformation based prediction, and luma/chroma signal based prediction.When angular prediction is performed, prediction having angles differentby a predetermined unit that includes at least one sample of the currentblock may be performed. The predetermined unit may be, for example, atleast one of a singular sample, a sample group, a line, and a block. Instep S530, filtering on a prediction sample may be additionallyperformed.

In order to derive the intra-prediction mode of the current block, atleast one reconstructed neighbor block may be used. A position of thereconstructed neighbor block may be a fixed position that is predefined,or may be a position derived by encoding/decoding. Hereinafter,encoding/decoding may mean entropy encoding and decoding. For example,when a coordinate of a left upper corner side sample of a current blockhaving a W×H size is (0, 0), a neighbor block may be at least one ofblocks adjacent to coordinate of (−1, H−1), (W−1, −1), (W, −1), (−1, H),and (−1, −1), and neighbor blocks of the above blocks.

An intra-prediction mode of a neighbor block which is not available maybe replaced with a predetermined intra-prediction mode. Thepredetermined intra-prediction mode may be, for example, a DC mode, aplanar mode, a vertical mode, a horizontal mode, and/or a diagonal mode.For example, when a neighbor block is positioned outside of a boundaryof at least one predetermined unit of a picture, a slice, a tile, and acoding tree unit, the neighbor block is inter-predicted, or when theneighbor block is encoded in a PCM mode, the corresponding block may bedetermined as non-available.

The intra-prediction mode of the current block may be derived as astatistical value of an intra-prediction mode of a predeterminedpositional neighbor block or an intra-prediction mode of at least twoneighbor blocks. In the present description, the statistical value maymean at least one of an average value, a maximum value, a minimum value,a mode, a median value, a weighted average value, and an interpolationvalue.

Alternatively, the intra-prediction mode of the current block may bederived based on a size of neighbor blocks. For example, anintra-prediction mode of a neighbor block having relatively large sizemay be derived as the intra-prediction mode of the current block.Alternatively, a statistical value may be calculated by assigning alarge weight on an intra-prediction mode of a block having relativelylarge size.

Alternatively, whether or not the intra-prediction mode of the neighborblock is angular mode may be considered. For example, when theintra-prediction mode of the neighbor block is a non-angular mode, thenon-angular mode may be derived as the intra-prediction mode of thecurrent block. Alternatively, an intra-prediction mode of other neighborblock, except for the non-angular mode, may be derived as theintra-prediction mode of the current block.

In order to derive the intra-prediction mode of the current block, amost probable mode (MPM) list may be configured by using anintra-prediction mode of a neighbor block. A number N of candidate modesincluded in an MPM list may be fixed, or may be determined according toa size or form or both of the current block. The MPM list may beconfigured not to include an overlapped mode. When a number of availablecandidate modes is smaller than N, a predetermined candidate mode amongavailable candidate modes, for example, a mode obtained by adding orsubtracting a predetermined offset to an angular mode may be added tothe MPM list. Alternatively, at least one of a horizontal mode, avertical mode, a 45 angular mode, a 135 angular mode, a 225 angularmode, and a non-angular mode may be added to the MPM list. Thepredetermined offset may be 1, 2, 3, 4, or a positive integer.

The MPM list may be configured in a predetermined sequence based on aposition of the neighbor block. For example, the predetermined sequencemay be a sequence of blocks adjacent to a left side, an upper side, aleft lower corner side, a right upper corner side, and a left uppercorner side of the current block. A non-angular mode may be included inthe MPM list at an arbitrary position. For example, it may be added nextto intra-prediction modes of blocks adjacent to a left side and an upperside.

As another embodiment, the intra-prediction mode of the current blockmay be derived by using an intra-prediction mode derived by using an MPMlist and an intra-prediction mode of a neighbor block. For example, whenthe intra-prediction mode derived by using the MPM list is Pred_mpm, thePred_mpm may be changed by using the intra-prediction mode of theneighbor block. For example, when Pred_mpm is larger than theintra-prediction mode of the neighbor block (or larger than astatistical value of at least two intra-prediction modes), Pred_mpm maybe increased by n, otherwise, Pred_mpm may be decreased by n. Herein, nmay be a predetermined integer such as +1, +2, +3, 0, −1, −2, −3, etc.The intra-prediction mode of the current block may be derived as thechanged Pred_mpm. Alternatively, when at least one of Pred_mpm andintra-prediction modes of the neighbor block is a non-angular mode, theintra-prediction mode of the current block may be derived as thenon-angular mode. Alternatively, the intra-prediction mode of thecurrent block may be derived as an angular mode.

When an MPM flag is 0, a second MPM list including at least oneintra-prediction mode may be configured, and the intra-prediction modeof the current block may be derived by using a second MPM index(2nd_mpm_idx). Herein, a second indicator (for example, a second MPMflag) indicating whether or not the intra-prediction mode of the currentblock is included in the second MPM list may be encoded/decoded. Similarto a first MPM list, the second MPM list may be configured by usingintra-prediction modes of the neighbor block. Herein, theintra-prediction mode included in the first MPM list may not be includedin the second MPM list. A number of MPM lists is not limited to 1 or 2,N MPM lists may be used.

When the intra-prediction mode of the current block is not included inone of a plurality of MPM lists, a luma component intra-prediction modeof the current block may be encoded/decoded. In addition, a chromacomponent intra-prediction mode may be derived and encoded/decoded basedon an associated luma component intra-prediction mode.

When the current block is partitioned into a plurality of sub-blocks, inorder to derive an intra-prediction mode of each sub-block, at least oneof the described methods may be applied.

A size or form or both of a sub-block may be a predetermined size orblock or both (for example, 4×4), or may be determined according to asize or form or both of the current block. Alternatively, the size ofthe sub-block may be determined based on whether or not a neighbor blockof the current block is partitioned, or may be determined based on anintra-prediction mode of a neighbor block of the current block. Forexample, the current block may be partitioned based on a boundary atwhich an intra-prediction mode of a neighbor block is different.Alternatively, the current block may be partitioned based on whether theneighbor block is an intra coding block or an inter coding block.

An indicator (for example, NDIP_flag) representing that theintra-prediction mode of the current block is derived by using theintra-prediction mode of the neighbor block may be encoded/decoded. Theindicator may be encoded/decoded by at least one unit of the currentblock and the sub-block. Herein, when a size of the current block or thesub-block corresponds to a predetermined size or a predetermined sizerange, the indicator may be encoded/decoded.

Determining whether or not the size of the current block corresponds toa predetermined size may be performed based on a horizontal or verticallength of the current block. For example, when the horizontal orvertical length is a length capable of being partitioned, it isdetermined that the size of the current block corresponds to apredetermined size.

When the current block is partitioned into a plurality of sub-blocks, anintra-prediction mode of the plurality of sub-blocks may be derived in azig-zag sequence, or may be derived in parallel. An intra-predictionmode of the sub-block may be derived by at least one of methods ofderiving the intra-prediction mode of the current block. Herein, theneighbor block of the current block may be used as a neighbor block ofeach sub-block. Alternatively, the sub-block within the current blockmay be used as a neighbor block of each sub-block.

An intra-prediction mode of a sub-block included in a current block maybe derived by using an average value of an intra-prediction mode of thecurrent block and an intra-prediction mode of a block adjacent to a leftand upper side of a sample positioned at (0, 0) of each sub-block. Forexample, when an intra-prediction mode of a current block is larger thanthe above average value, the half of the above average value may besubtracted from the derived intra-prediction mode. When theintra-prediction mode of the current block is equal to or less than theabove average value, the half of the above average value may be added tothe derived intra-prediction.

Intra-prediction information of may be signaled through at least one ofa video parameter set (VPS), a sequence parameter set (SPS), a pictureparameter set (PPS), an adaptation parameter set (APS), a slice header,and a tile header. In a predetermined block size or less, at least onepiece of intra-prediction information may not be signaled. Herein,intra-prediction information of a previously encoded/decoded block (forexample, higher block) may be used.

A reference sample for intra-prediction may be configured based on thederived intra-prediction mode. In the description hereinafter, a currentblock may mean a prediction block or a sub-block having a size/formsmaller than a size/form of the prediction block. The reference samplemay be configured by using at least one sample reconstructed adjacent toa current block or by using a combination of samples. In addition,filtering may be applied to the configured reference sample.

A number or position or both of reconstructed sample lines used forconfiguring the reference sample may vary according to a position of acurrent block within a coding tree block. Each reconstructed sample on aplurality of reconstructed sample lines may be used as a referencesample at it is. Alternatively, a predetermined filter may be applied tothe reconstructed sample, and a reference sample may be generated byusing the filtered reconstructed sample. Reconstructed samples to whicha filter is applied may be included in the same reconstructed sampleline or in different reconstructed sample lines.

The configured reference sample may be represented as ref[m, n], and asample obtained by applying a filter to the configured reference samplemay be represented as rec[m, n]. Herein, m or n may be a predeterminedinteger value representing a position of a sample. When a position of aleft upper side sample within the current block is (0, 0), a position ofa left upper side reference sample of the current block may be set to(−1, −1).

FIG. 6 is a view showing an example of configuring a reference sampleline when a current block is not adjacent to a CTU boundary.

FIG. 7 is a view showing an example of configuring a reference sampleline when a current block is adjacent to a CTU boundary.

At least one reference sample line may be configured by using at leastone of a plurality of reconstructed sample lines shown in FIG. 6 andFIG. 7. Herein, a position or length or both of the used at least onereconstructed sample line may be determined based on a position of acurrent block within a predetermined image region. The predeterminedimage region may mean at least one of a picture, a slice, a slicesegment, a tile, and a coding block (e.g., a coding block partitionedbased on at least one of a coding tree block, andquad-tree/binary-tree). For example, a reconstructed sample line to beused may be selected by considering whether or not at least one blockboundary of the current block is adjacent to the boundary of thepredetermined image region.

As shown in FIG. 6, all of usable reconstructed sample lines(reconstructed sample lines 1 to 4) may be positioned within a CTUidentical to a current block. Alternatively, as shown in FIG. 7, all ora partial of usable reconstructed sample lines may be positioned withina CTU different from the current block.

According to an embodiment of the present invention, a single referencesample line may be configured by using a single reconstructed sampleline adjacent to a current block.

In the example shown in FIG. 6, an identical reconstructed sample linemay be used for an upper side and a left side of the current block. Forexample, the reference sample line of the current block may beconfigured by using a reconstructed sample line 2 for both of upper sideand the left side.

In the example shown in FIG. 7, reconstructed sample lines differentfrom each other may be used for an upper side and a left side of thecurrent block. For example, a reference sample line may be configured byusing a reconstructed sample line 1 for the upper side of the currentblock as the Formula 1 below, and using a reconstructed sample line 2for the left side of the current block.ref[x,−1]=rec[x,−1],(x=−1˜2*W−1)ref[−1,y]=rec[−2,y],(y=0˜2*H−1)  [Formula 1]

According to another embodiment of the present invention, a singlereference sample line may be configured by using at least tworeconstructed sample lines adjacent to a current block.

Herein, a weighted sum of reconstructed samples on at least tworeconstructed sample lines may be used based on a distance from acurrent block or an intra-prediction mode angle or both. A weight may bedetermined based on at least one of an intra-prediction mode of thecurrent block (e.g., a prediction mode value, whether or not an angularmode is, angle of an angular mode, etc.), a block size/form, partitioninformation, neighbor encoding information (neighbor intra-predictionmode, block size/form, partition information, etc.), or an arbitraryfilter (for example, at least one of a 3-tap filter, a 5-tap filter, anda 7-tap filter). When a distance from the current block becomes larger,a larger weight may be assigned.

In the example shown in FIG. 6, identical reconstructed sample lines maybe used for both of the upper side and the left side. For example, asthe Formula 2 below, the reference sample may be configured by using aweighted sum of the reconstructed sample line 1 and the reconstructedsample line 2.ref[−1,−1]=(rec[−2,−1]+2*rec[−1,−1]+rec[−1,−2]+2)>>2ref[x,−1]=(rec[x,−2]+3*rec[x,−1]+2)>>2,(x=0˜2*W−1)ref[−1,y]=(rec[−2,y]+3*rec[−1,y]+2)>>2,(y=0˜2*H−1)  [Formula 2]

In the example shown in FIG. 7, reconstructed sample lines differentfrom each other may be used for the upper side and the left side. Forexample, as the Formula 3 below, the reference sample may be configuredby using reconstructed sample lines 1 and 2 for the left side of thecurrent block, and using the reconstructed sample line 1 for the upperside of the current block.ref[−1,−1]=(rec[−2,−1]+3*rec[−1,−1]+2)>>2ref[x,−1]=rec[x,−1],(x=0˜2*W−1)ref[−1,y]=(rec[−2,y]+3*rec[−1,y]+2)>>2,(y=0˜2*H−1)  [Formula 3]

In the above embodiment of configuring a single reference sample line byusing at least two reconstructed sample lines, the weighted sum may bereplaced with at least one of an average value, a maximum value, aminimum value, and a median value. The reconstructed sample used in thereconstructed sample line may be variably determined according to aposition of a current sample, or may be determined to a fixed positionalsample. The fixed positional sample may vary according to a direction orangle of an intra-prediction mode.

For example, in the example shown FIG. 6, a reference sample may beconfigured as the Formula 4 below by using a maximum value ofreconstructed sample lines 1 to 3 for both of the upper side and theleft side of the current block. max(a, b, c) is a function outputtingthe largest value among a, b, and c.ref[−1,−1]=max(max(rec[−3,−3],rec[−2,−3],rec[−1,−3]),max(rec[−3,−2],rec[−2,−2],rec[−1,−2]),max(rec[−3,−1],rec[−2,−1],rec[−1,−1]))ref[x,−1]=max(rec[x,−1],rec[x,−2],rec[x,−3]),(x=0˜2*W−1)ref[−1,y]=max(rec[−1,y],rec[−2,y],rec[−3,y]),(y=0˜2*H−1)  [Formula 4]

For example, in the example shown in FIG. 7, a reference sample may beconfigured as the Formula 5 below by using a maximum value ofreconstructed sample lines 1 to 3 for the left side of the currentblock, and using a maximum value of reconstructed sample lines 1 and 2for the upper side of the current block.ref[−1,−1]=max(0,max(rec[−3,−2],rec[−2,−2],rec[−1,−2]),max(rec[−3,−1],rec[−2,−1],rec[−1,−1]))ref[x,−1]=max(rec[x,−1],rec[x,−2],0),(x=0˜2*W−1)ref[−1,y]=max(rec[−1,y],rec[−2,y],rec[−3,y]),(y=0˜2*H−1)  [Formula 5]

According to another embodiment of the present invention, at least tworeference sample lines may be configured by using at least tworeconstructed sample lines adjacent to a current block.

In the example shown in FIG. 6, at least two reference sample lines maybe configured by using at least two reconstructed sample lines for bothof the upper side and the left side of the current block. For example,the reconstructed sample lines 1 and 2 may be respectively selected forreference sample lines 1 and 2 of the current block.

In the example shown in FIG. 7, at least two reference sample lines maybe configured by using reconstructed sample lines different from eachother for the upper side and the left side of the current block. Forexample, reference sample lines 1 and 2 may be configured as the Formula6 below by using reconstructed sample lines 1 and 2 for the left side ofthe current block and using the reconstructed sample line 1 for theupper side of the current block.ref[x,−1]=rec[x,−1],(x=−1˜2*W−1)ref[−1,y]=rec[−1,y],(y=0˜2*H−1)ref[−2,−2]=ref[−2,−1]=rec[−1,−1]ref[x,=2]=rec[x,−1 1],(x=−1˜2*W−1)ref[2*W,−2]=rec[2*W−1,−1]ref[−2,y]=rec[−2,y],(y=0˜2*H)  [Formula 6]

As another example of configuring at least two reference sample lines byusing at least two reconstructed sample lines adjacent to a currentblock, a plurality of reference sample lines may be configured by usingat least one of a weighted sum, an average value, a maximum value, aminimum value, and a median value of at least one reconstructed samplebased on a distance from the current block or an angle of anintra-prediction mode or both. The reconstructed sample used in thereconstructed sample line may variably determined according to aposition of a current sample, or may be determined to a fixed positionalsample. The fixed positional sample may vary according to a direction oran angle of an intra-prediction mode.

In one example, each reference sample line may be configured based on aweighted sum using different weights differently assigned according to adistance from the current block, and a maximum value of a reconstructedsample. The reconstructed sample line used for the weighted sum and thereconstructed sample line used for the maximum value may be different.

In the example shown in FIG. 6, the reference sample may be configuredby using an identical number of reconstructed sample lines for both ofthe upper side and the left side of the current block. For example, asthe Formula 7 below, a reference sample line 1 may be configured by aweighted sum of reconstructed sample lines 1 and 2, and a referencesample line 2 may be configured by a maximum value of reconstructedsample lines 2 to 4.ref[−1,−1]=(rec[−2,−1]+2*rec[−1,−1]+rec[−1,−2]+2)>>2ref[x,−1]=(rec[x,−2]+3*rec[x,−1]+2)>>2,(x=0˜2*W−1)ref[−1,y]=(rec[−2,y]+3*rec[−1,y]+2)>>2,(y=0˜2*H−1)ref[−2,−2]=max(max(rec[−4,−4],rec[−3,−4],rec[−2,−4]),max(rec[−4,−3],rec[−3,−3],rec[−2,−3]),max(rec[−4,−2],rec[−3,−2],rec[−2,−2]))ref[x,−2]=max(rec[x,−2],rec[x,−3],rec[x,−4]),(x=0˜2*W)ref[−2,y]=max(rec[−2,y],rec[−3,y],rec[−4,y]),(y=0˜2*H)  [Formula 7]

In the example shown in FIG. 7, the reference sample may be configuredas by using different reconstructed sample lines for the upper side andthe left side of the current block. For example, as the Formula 8 below,a reference sample line 1 may be configured by using a weighted sum ofreconstructed sample lines 1 and 2 for the left side of the currentblock, and a reference sample line may be configured by using a maximumvalue of reconstructed sample lines 2 to 4. In addition, reconstructedsample lines 1 and 2 may be configured by using the reconstructed sampleline 1 for the upper side of the current block.ref[x,−1]=rec[x,−1],(x=−1˜2*W−1)ref[−1,y]=(rec[−2,y]+3*rec[−1,y]+2)>>2,(y=0˜2*H−1)ref[−2,−2]=ref[−2,−1]=rec[−1,−1]ref[x,−2]=rec[x,−1],(x=−1˜2*W−1)ref[2*W,−2]=rec[2*W−1,−1]ref[−2,y]=max(rec[−2,y],rec[−3,y],rec[−4,y]),(y=0˜2*H)  [Formula 8]

Information representing that the reference sample is configured byusing at least one of the above described methods may beencoded/decoded, or may be implicitly derived in a decoder.Alternatively, when information of reference sample shifting isencoded/decoded, at least one of below entropy encoding methods may beused, and the information is finally encoded/decoded by using aCABAC(ae(v)) after being binarized.

-   -   a truncated rice binarization method    -   a K-th order exp_Golomb binarization method    -   a restricted K-th order exp_Golomb binarization method    -   a fixed-length binarization method    -   a unary binarization method    -   a truncated unary binarization method

An embodiment in which an upper boundary of a current block is aboundary of a CTU has been described with reference to FIG. 7. However,it is not limited thereto, the embodiment of the present invention maybe applied when a left boundary of the current block is a boundary of aCTU. Herein, in the above described embodiment, a left side and an upperside may be switched and applied.

When both of an upper boundary and a left boundary of a current blockare boundaries of a CTU, an identical reconstructed sample line may beused for an upper side and a left side of the current block.Alternatively, a number of reconstructed sample lines which is largerthan a number of reconstructed sample lines that may be used for theupper side of the current block may be used for the left side of thecurrent block. This is because, a resource required for storing areconstructed sample line included in a CTU adjacent to the upper sideof the current block is relatively larger than a resource required forstoring a reconstructed sample line included in a CTU adjacent to theleft side of the current block.

Alternatively, when an upper boundary of a current block is a boundaryof a CTU, all of upper side reference samples may be determined to benon-available. Herein, an upper side reference sample may be configuredby using a left side reference sample. Alternatively, when a leftboundary is a boundary of a CTU, a left side reference sample may beconfigured by using an upper side reference sample.

In the above embodiment, the boundary of the CTU may be replaced with aboundary of a predetermined image region. The predetermined image regionincludes, as described above, a picture, a slice, a slice segment, atile, etc.

Intra-prediction may be performed by retrieving a block that is mostlysimilar to a current block from a neighbor reconstructed sample rec[m,n] (hereinafter, referred as “similar block”). Herein, at least one ofpositional information m and n of the similar block may be entropyencoded/decoded. Alternatively, a decoder may derive positionalinformation of the similar block by performing an identical process withan encoder.

The derived similar block may be used as a prediction block of thecurrent block. Alternatively, at least one reference sample line of thederived similar block may be used as a reference sample of the currentblock. Alternatively, a reference sample of the current block may bederived by using at least one of at least one reference sample line ofthe current block and at least one reference sample line of the similarblock. Herein, for example, a weighted sum may be used. Alternatively,an upper side reference sample and a left side reference sample of thecurrent block may be respectively configured from different referencesample lines.

Alternatively, by performing intra-prediction of the current block, afirst residual signal is obtained. Herein, the used intra-predictionmode is applied to the similar block to obtain a second residual signal,and a residual signal of the current block may be generated by usingresidual values of the first residual signal and the second residualsignal.

When selecting a reference sample of the current block forinter-prediction, an optimized reference sample of the current block maybe configured by retrieving all available reconstructed samples presentin the reconstructed left side and upper side samples. Herein, areference sample may be configured by shifting the retrievedreconstructed samples to a position whereby the shifted samples may beused when intra-predicting. Information of shifting the reference samplemay be entropy encoded/decoded, or may be implicitly derived in anencoder/decoder.

After configuring the reference sample of the current block, thereference sample of the current block may be re-configured by exchangingand replacing reference samples with at least one reference sample unit.For example, a sample that is present on an upper side reconstructedsample line or an upper side reference sample line, a sample on a leftside reference sample line by using a sample group, or a sample groupmay be exchanged or replaced or both.

The current block may be partition into at least one prediction blockaccording to a size or form or both of the current block. An identicalreference sample may be used for the partitioned prediction blocks.Herein, a parallel process may be possible for at least one predictionblock included in the current block

Alternatively, different reference samples may be used for thepartitioned prediction blocks. For example, when the current block ispartitioned into prediction blocks of an upper side and a lower side, acorrelation between an upper side reference sample of the current blockwith the lower side prediction block may be low. Herein, the upper sidereference sample may be compensated to be used as a reference sample ofthe prediction block. For compensating, reference samples of a left sidereference sample line may be used. For example, residual values of asample of (−1, −1) position and a sample of (−1, H/2-1) position may beused. Herein, H is a height of the current block. The residual value ora value obtained by scanning the residual value may be applied to theupper side reference sample. A method of configuring the referencesample may be similarly applied when the current block is partitionedinto left side and right side prediction blocks or into at least twoprediction blocks.

In order to configure the reference sample, whether or not a neighborreconstructed sample is available may be determined. When a neighborreconstructed sample is positioned outside of at least one region of apicture, a slice, a tile, and a CTU, it may be determined as notavailable. Alternatively, when constrained intra prediction is performedon the current block, the neighbor reconstructed sample may bedetermined as not available when the neighbor reconstructed sample ispositioned at a block that is inter encoded/decoded.

When the neighbor reconstructed sample is determined as non-available,the non-available sample may be replaced by using a neighbor availablereconstructed sample. For example, the non-available sample may bereplaced by using a neighbor available sample starting from a left lowerside sample position. Alternatively, the non-available sample may bereplaced by combing available samples. For example, the non-availablesample may be replaced by using an average value of available sampleswhich are positioned at both ends of the non-available sample.

Alternatively, non-available samples may be replaced by usinginformation of available reference samples. Herein, the non-availablesample may be replaced with an arbitrary value that is not a neighboravailable sample value. The arbitrary value may be an average value ofavailable sample values, or a value considering a gradient of availablesample values. Alternatively, both of the average value and the gradientmay be used. The gradient may be determined based on residual values ofneighbor available samples. Alternatively, the gradient may bedetermined based on the average value and the residual value of theavailable sample value. Except for the average value, a maximum value, aminimum value, a median value, or a weighted sum using an arbitraryweight may be used. The arbitrary weight may be determined based on adistance between an available sample and a non-available sample.

The above methods may be applied to all upper side and left sidereference samples, or may be applied to an arbitrary angle. In addition,when a reference sample line of a current block is configured by using aplurality of reconstructed sample lines, the above method may beapplied.

Whether or not to apply filtering to at least one reference sampleconfigured as above may be determined based on at least one of anintra-prediction mode of a current block and a block size/form. Whenfilter is applied, a filtering type may vary according to at least oneor an intra-prediction mode, a size, and a form of the current block.

Intra-prediction of the current block may be performed based on thederived intra-prediction mode and the reference sample.

In case of a DC mode, an average value of at least one reference sampleamong the configured reference sample may be used. Herein, filtering maybe applied to at least one prediction sample positioned at a boundary ofthe current block.

In case of a planar mode, a weighted sum considering a distance from theat least one configured reference sample according to a position of asample being a target of intra-prediction of the current block may beused.

In case of an angular mode, at least one reference sample positioned ata predetermined angle and present adjacent in the position of theintra-prediction target sample may be used.

In case of an intra-prediction mode based on positional information, areconstructed sample block generated based on encoded/decoded or derivedpositional information may be used as an intra prediction block of acurrent block. Alternatively, a decoder may derive by retrieving areconstructed sample block that will be used as an intra predictionblock of a current block.

Intra-prediction of a chroma signal may be performed by using areconstructed luma signal of a current block. In addition,intra-prediction of other chroma signal Cr may be performed by using asingle reconstructed chroma signal Cb of the current block.

Inter-prediction may be performed by combining the at least one abovemethod. For example, an intra prediction block of a current block may beconfigured by using a weighted sum of a predicted block using apredetermined non-angular intra-prediction mode and a predicted blockusing a predetermined angular intra-prediction mode. Herein, a weightmay be differently applied according to at least one of anintra-prediction mode, a block size, and a sample position.

When at least one reference sample line is used, an intra predictionblock may be generated by assigning weights different from each otheraccording to a distance to the current block or an angle or both. Aweighted sum may be an arbitrary filter precision according to at leastone of an intra-prediction mode, a block size/form, partitioninformation, neighbor encoding information (neighbor intra-predictionmode, block size/form, partition information, etc.) of a current block.

In case of an angular mode, the configured reference sample may bere-configured based on an angular prediction mode. For example, when theangular prediction mode is a mode using all of left side and upper sidereference samples, a one-dimensional array may be configured for theleft side or upper side reference sample. Alternatively, an upper sidereference sample may be configured by shifting a left side referencesample, or an upper side reference sample may be configured by using aweighted sum of at least one left side reference sample.

Inter-prediction in angles different from each other may be performed ona predetermined sample group unit of a current block. The predeterminedsample group unit may be a block, a sub-block, a line or a singularsample.

In case of a planar mode, a weighted sum of an upper side referencesample T, a left side reference sample L, a right upper side referencesample TR, and a left lower side reference sample BL based on a positionof a prediction target sample may be used. Herein, a right lower sidesample K may be derived by using a weighted sum of TR and BL. Samples ofa low ray within a current block may be replaced with BL, and samples ofa right column may be replaced with TR.

A sample present at an arbitrary position (x, y) within a current blockmay be predicted as a weighted sum considering a distance according to aposition of each sample. For example, samples of a low row within thecurrent block may be derived as a weighted sum according to BL and a Kdistance, and samples of a right column may be derived as a weighted sumof TR and a K distance.

The above embodiments may be performed in the same method in an encoderand a decoder.

A sequence of applying to above embodiment may be different between anencoder and a decoder, or the sequence applying to above embodiment maybe the same in the encoder and the decoder.

The above embodiment may be performed on each luma signal and chromasignal, or the above embodiment may be identically performed on luma andchroma signals.

A block form to which the above embodiments of the present invention areapplied may have a square form or a non-square form.

The above embodiment of the present invention may be applied dependingon a size of at least one of a coding block, a prediction block, atransform block, a block, a current block, a coding unit, a predictionunit, a transform unit, a unit, and a current unit. Herein, the size maybe defined as a minimum size or maximum size or both so that the aboveembodiments are applied, or may be defined as a fixed size to which theabove embodiment is applied. In addition, in the above embodiments, afirst embodiment may be applied to a first size, and a second embodimentmay be applied to a second size. In other words, the above embodimentsmay be applied in combination depending on a size. In addition, theabove embodiments may be applied when a size is equal to or greater thata minimum size and equal to or smaller than a maximum size. In otherwords, the above embodiments may be applied when a block size isincluded within a certain range.

For example, the above embodiments may be applied when a size of currentblock is 8×8 or greater. For example, the above embodiments may beapplied when a size of current block is 4×4 or greater. For example, theabove embodiments may be applied when a size of current block is 16×16or greater. For example, the above embodiments may be applied when asize of current block is equal to or greater than 16×16 and equal to orsmaller than 64×64.

The above embodiments of the present invention may be applied dependingon a temporal layer. In order to identify a temporal layer to which theabove embodiments may be applied may be signaled, and the aboveembodiments may be applied to a specified temporal layer identified bythe corresponding identifier. Herein, the identifier may be defined asthe lowest layer or the highest layer or both to which the aboveembodiment may be applied, or may be defined to indicate a specificlayer to which the embodiment is applied. In addition, a fixed temporallayer to which the embodiment is applied may be defined.

For example, the above embodiments may be applied when a temporal layerof a current image is the lowest layer. For example, the aboveembodiments may be applied when a temporal layer identifier of a currentimage is 1. For example, the above embodiments may be applied when atemporal layer of a current image is the highest layer.

A slice type to which the above embodiments of the present invention areapplied may be defined, and the above embodiments may be applieddepending on the corresponding slice type.

In the above-described embodiments, the methods are described based onthe flowcharts with a series of steps or units, but the presentinvention is not limited to the order of the steps, and rather, somesteps may be performed simultaneously or in different order with othersteps. In addition, it should be appreciated by one of ordinary skill inthe art that the steps in the flowcharts do not exclude each other andthat other steps may be added to the flowcharts or some of the steps maybe deleted from the flowcharts without influencing the scope of thepresent invention.

The embodiments include various aspects of examples. All possiblecombinations for various aspects may not be described, but those skilledin the art will be able to recognize different combinations.Accordingly, the present invention may include all replacements,modifications, and changes within the scope of the claims.

The embodiments of the present invention may be implemented in a form ofprogram instructions, which are executable by various computercomponents, and recorded in a computer-readable recording medium. Thecomputer-readable recording medium may include stand-alone or acombination of program instructions, data files, data structures, etc.The program instructions recorded in the computer-readable recordingmedium may be specially designed and constructed for the presentinvention, or well-known to a person of ordinary skilled in computersoftware technology field. Examples of the computer-readable recordingmedium include magnetic recording media such as hard disks, floppydisks, and magnetic tapes; optical data storage media such as CD-ROMs orDVD-ROMs; magneto-optimum media such as floptical disks; and hardwaredevices, such as read-only memory (ROM), random-access memory (RAM),flash memory, etc., which are particularly structured to store andimplement the program instruction. Examples of the program instructionsinclude not only a mechanical language code formatted by a compiler butalso a high level language code that may be implemented by a computerusing an interpreter. The hardware devices may be configured to beoperated by one or more software modules or vice versa to conduct theprocesses according to the present invention.

Although the present invention has been described in terms of specificitems such as detailed elements as well as the limited embodiments andthe drawings, they are only provided to help more general understandingof the invention, and the present invention is not limited to the aboveembodiments. It will be appreciated by those skilled in the art to whichthe present invention pertains that various modifications and changesmay be made from the above description.

Therefore, the spirit of the present invention shall not be limited tothe above-described embodiments, and the entire scope of the appendedclaims and their equivalents will fall within the scope and spirit ofthe invention.

INDUSTRIAL APPLICABILITY

The present invention may be used in encoding/decoding an image.

The invention claimed is:
 1. An image decoding method, comprising:deriving an intra prediction mode of a current block; deriving areference sample of intra prediction for the current block from aplurality of reference sample lines; and generating a prediction blockby performing intra prediction for the current block based on the intraprediction mode and the reference sample, wherein the deriving thereference sample of intra prediction for the current block comprises:determining whether an upper boundary of the current block is an upperboundary of a current coding tree block or not; and selecting areference sample line for deriving the reference sample among theplurality of reference sample lines based on the determination, wherein,in case the upper boundary of the current block is the upper boundary ofthe current coding tree block, the reference sample is derived using afirst reference sample line adjacent to the current block among theplurality of reference sample lines.
 2. The method of claim 1, whereindifferent number of reference samples lines are used according towhether the boundary of the current block is the boundary of the currentcoding tree block.
 3. The method of claim 1, wherein, in case theboundary of the current block is not the boundary of the current codingtree block, the reference sample is derived using the first referencesample line and a second reference sample line of the current blockamong the plurality of reference sample lines.
 4. The method of claim 1,wherein the intra prediction mode of the current block is derived basedon an intra prediction mode of a left neighboring block and an intraprediction mode of an upper neighboring block, the left neighboringblock being a block adjacent to a lower-left side of the current blockand the upper neighboring block being a block adjacent to an upper-rightside of the current block.
 5. The method of claim 4, wherein the intraprediction mode of the current block is derived based on a statisticvalue of the intra prediction mode of the left neighboring block and theintra prediction mode of the upper neighboring block.
 6. The method ofclaim 5, wherein all of a maximum value and a minimum value are used asthe statistic value.
 7. The method of claim 1, wherein the deriving theintra prediction mode of the current block comprises decoding a firstflag indicating whether the intra prediction mode is identical to a modeincluded in a first Most Probable Mode (MPM) list including at least onemode; and determining the mode included in the first MPM list as theintra prediction mode when the first flag is a first value.
 8. Themethod of claim 7, wherein the deriving the intra prediction mode of thecurrent block comprises configuring a second MPM list including at leastone mode when the first flag is a second value; decoding indexinformation indicating a mode identical to the intra prediction mode ofthe current block; and deriving the intra prediction mode of the currentblock using the second MPM list and the index information.
 9. The methodof claim 1, wherein, the determining whether the boundary of the currentblock is the boundary of the current coding tree block or not ischaracterized by determining whether the boundary of the current blockis overlapped with the boundary of the current coding tree block or not,and in case the boundary of the current block is overlapped with theboundary of the current coding tree block, the reference sample isderived using the first reference sample line adjacent to the currentblock among the plurality of reference sample lines.
 10. An imageencoding method, comprising: determining an intra prediction mode of acurrent block; deriving a reference sample of intra prediction for thecurrent block from a plurality of reference sample lines; and generatinga prediction block by performing intra prediction for the current blockbased on the intra prediction mode and the reference sample, wherein thederiving the reference sample of intra prediction for the current blockcomprises: determining whether an upper boundary of the current block isan upper boundary of a current coding tree block or not; and selecting areference sample line for deriving the reference sample among theplurality of reference sample lines based on the determination, wherein,in case the upper boundary of the current block is the upper boundary ofthe current coding tree block, the reference sample is derived using afirst reference sample line adjacent to the current block among theplurality of reference sample lines.
 11. The method of claim 10, whereindifferent number of reference samples lines are used according towhether the boundary of the current block is the boundary of the currentcoding tree block.
 12. The method of claim 10, wherein, in case theboundary of the current block is not the boundary of the current codingtree block, the reference sample is derived using the first referencesample line and a second reference sample line of the current blockamong the plurality of reference sample lines.
 13. The method of claim10, wherein the intra prediction mode of the current block is encodedbased on an intra prediction mode of a left neighboring block and anintra prediction mode of an upper neighboring block, the leftneighboring block being a block adjacent to a lower-left side of thecurrent block and the upper neighboring block being a block adjacent toan upper-right side of the current block.
 14. The method of claim 13,wherein the intra prediction mode of the current block is encoded basedon a maximum value and a minimum value of the intra prediction mode ofthe left neighboring block and the intra prediction mode of the upperneighboring block.
 15. The method of claim 10, further comprisingencoding the intra prediction mode of the current block, wherein theencoding the intra prediction mode comprises determining whether theintra prediction mode is identical to a mode included in a first MostProbable Mode (MPM) list including at least one mode; and encoding afirst flag having a first value in case the intra prediction mode isidentical to a mode included in the first MPM list.
 16. The method ofclaim 15, wherein the encoding the intra prediction mode comprisesconfiguring a second MPM list including at least one mode in case theintra prediction mode is not identical to a mode included in the firstMPM list; determining an index indicating a mode identical to the intraprediction mode of the current block among modes included in the secondMPM list; and encoding the first flag having a second value and theindex.
 17. The method of claim 10, wherein, the determining whether theboundary of the current block is the boundary of the current coding treeblock or not is characterized by determining whether the boundary of thecurrent block is overlapped with the boundary of the current coding treeblock or not, and in case the boundary of the current block isoverlapped with the boundary of the current coding tree block, thereference sample is derived using the first reference sample lineadjacent to the current block among the plurality of reference samplelines.
 18. A non-transitory computer-readable recording medium storing abitstream which is received and decoded by an image decoding apparatusand used to reconstruct an image, wherein the bitstream comprisesinformation on prediction of a current block, the information onprediction of the current block is used to derive an intra predictionmode of the current block, the intra prediction mode of the currentblock is used to generate a prediction block by performing intraprediction for the current block, a reference sample used for the intraprediction is derived from a plurality of reference sample lines, andwherein a reference sample line used for deriving the reference sampleis selected from the plurality of reference sample lines based onwhether an upper boundary of the current block is an upper boundary of acurrent coding tree block, wherein, in case the upper boundary of thecurrent block is the upper boundary of the current coding tree block,the reference sample is derived using a first reference sample lineadjacent to the current block among the plurality of reference samplelines.
 19. The medium of claim 18, wherein, the reference sample line isselected from the plurality of reference sample lines based on whetherthe boundary of the current block is overlapped with the boundary of thecurrent coding tree block, in case the boundary of the current block isoverlapped with the boundary of the current coding tree block, thereference sample is derived using the first reference sample lineadjacent to the current block among the plurality of reference samplelines.